package com.itheima.stock.service.Impl;

import com.itheima.stock.entity.StockBusiness;
import com.itheima.stock.mapper.StockBusinessMapper;
import com.itheima.stock.response.ResponseResult;
import com.itheima.stock.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 股票业务实现接口
 */
@Service
public class StockServiceImpl implements StockService {
    private final StockBusinessMapper stockBusinessMapper;

    public StockServiceImpl(StockBusinessMapper stockBusinessMapper) {
        this.stockBusinessMapper = stockBusinessMapper;
    }

    /**
     * 获取股票业务
     *
     * @return
     */
    @Override
    public ResponseResult<List<StockBusiness>> getStockBusiness() {
        //1.校验参数
        //2.处理业务
        //3.数据返回
        List<StockBusiness> stockBusinesses = stockBusinessMapper.selectAll();
        return ResponseResult.ok(stockBusinesses);

    }
}
